-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort books in read menu #34266
Sort books in read menu #34266
Conversation
src/game_inventory.cpp
Outdated
if( !book_a.skill && !book_b.skill ) { | ||
return ( book_a.fun == book_b.fun ) ? base_sort : book_a.fun > book_b.fun; | ||
} else if( !book_a.skill || !book_a.skill ) { | ||
return book_a.skill ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return book_a.skill ? true : false; | |
return book_a.skill.has_value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, doesn't have has_value() which seems to be a cata::optional thing but i get back a string_id<>.
Possible alternatives:
!book_a.skill.is_null()
!!book_a.skill
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stupid null ids. Use !book_a.skill.is_null()
in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I settled for static_cast() which uses the skill_id operator just in case.
|
||
if( !book_a.skill && !book_b.skill ) { | ||
return ( book_a.fun == book_b.fun ) ? base_sort : book_a.fun > book_b.fun; | ||
} else if( !book_a.skill || !book_a.skill ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there an error?
} else if( !book_a.skill || !book_a.skill ) { | |
} else if( !book_a.skill || !book_b.skill ) { |
Summary
SUMMARY: Interface "Sort books in read menu"
Purpose of change
Fixes #33555
Additional context